import { FractionService } from './services/fraction.service';
import { CommonInterceptor } from "./../services/common.interceptor";
import {
    HttpCode, Controller, UseInterceptors, Post, FilesInterceptor, UploadedFiles, FileInterceptor, UploadedFile,
    Param, Body,
} from '@nestjs/common';



@Controller()
@UseInterceptors(new CommonInterceptor())
export class FractionController {
    constructor(
        public fractionService: FractionService,
    ) {
    }
    @Post('upload')
    @UseInterceptors(FileInterceptor('file'))
    async uploadFile(@UploadedFile() file, @Body() params) {
       const data = await this.fractionService.upload(file, params.dept);
       return data || [];
    }

    @Post('find')
    @HttpCode(200)
    async find( @Body() params) {
        return  await this.fractionService.find(params);
    }
}